package com.liusy.taskengine.taskexecute;

import org.apache.log4j.Logger;

import com.liusy.taskengine.TaskManager;
import com.liusy.taskengine.executemodel.AbstractExecuteModel;
import com.liusy.taskengine.executemodel.IExecuteModel;
import com.liusy.taskengine.taskmodel.ITaskModel;


/**
 * 执行器抽象结口
 * 
 * @author liusy 2012-12-11
 *
 */
public abstract class AbstractTaskExecute extends Thread implements ITaskExecute  {
	
	private static Logger log = Logger.getLogger(AbstractExecuteModel.class);
	
	//名字
	protected String taskExecuteName= "我是执行器(执行者的工具)........";
		
	//管理者
	protected TaskManager taskManager= null;
	
	//执行者
	protected IExecuteModel executeModel = null;
	
	//任务
	public ITaskModel taskModel = null;
	
	
	/**
	 * 执行器需要 的任务，执行者
	 * 
	 * @param taskModel 任务
	 * @param executeModel 执行者
	 * @param taskManager  执行器管理
	 */
	public AbstractTaskExecute(ITaskModel taskModel, IExecuteModel executeModel,TaskManager taskManager)
	{
		this.taskModel = taskModel;
		this.executeModel = executeModel;
		this.taskManager = taskManager;
	}
	

	@Override
	public void ExecuteDestroy(TaskManager o, Object arg) {
		this.interrupt();
		
	}

	/**
	 * 执行器需要 的任务
	 * 
	 * @param taskModel 任务
	 */
	public void ExecuteTaskJob(ITaskModel taskModel){
		this.taskModel = taskModel;
	}

	public String getTaskExecuteName() {
		return taskExecuteName;
	}

	public void setTaskExecuteName(String taskExecuteName) {
		this.taskExecuteName = taskExecuteName;
	}

	public TaskManager getTaskManager() {
		return taskManager;
	}

	public void setTaskManager(TaskManager taskManager) {
		this.taskManager = taskManager;
	}

	public IExecuteModel getExecuteModel() {
		return executeModel;
	}

	public void setExecuteModel(IExecuteModel executeModel) {
		this.executeModel = executeModel;
	}

	public ITaskModel getTaskModel() {
		return taskModel;
	}

	public void setTaskModel(ITaskModel taskModel) {
		this.taskModel = taskModel;
	}


}
